@extends('admin/layouts.default')

{{-- Web site Title --}}
@section('title')
Edit ATM ::
@parent
@stop

{{-- Content --}}
@section('content')
<div class="page-header">
    <h3>
        Edit ATM

        <div class="pull-right">
            <a href="{{{ URL::to('admin/locations') }}}" class="btn btn-small btn-inverse"><i class="icon-circle-arrow-left icon-white"></i> Back</a>
        </div>
    </h3>
</div>

<!-- Tabs -->
<ul class="nav nav-tabs">
    <li class="active"><a href="#tab-general" data-toggle="tab">General</a></li>
    <li><a href="#tab-address" data-toggle="tab">Address</a></li>
    <li><a href="#tab-media" data-toggle="tab">Media</a></li>
</ul>
<!-- ./ tabs -->

<form class="form-horizontal custom-xlarge" method="post" action="" autocomplete="off" enctype="multipart/form-data">
     <!-- CSRF Token -->
    <input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
    <!-- ./ csrf token -->
      <!-- Tabs Content -->
    <div class="tab-content">
        <!-- General tab -->
        <div class="tab-pane active" id="tab-general">
            <!-- Post Title -->
            <div class="control-group {{{ $errors->has('name') ? 'error' : '' }}}">
                <label class="control-label" for="title">Name</label>
                <div class="controls">
                    <input type="text" name="name" id="title" class="span10" value="{{{ $location->name }}}" />
                    {{ $errors->first('name', '<span class="help-inline">:message</span>') }}
                </div>
            </div>
            <!-- ./ post title -->
            {{-- Province --}}
            <div class="control-group {{{ $errors->has('province') ? 'error' : '' }}}">
                <label class="control-label" for="title">Province</label>
                <div class="controls">
                    <select name="province" id="province">
                       @foreach ($provinces as $province)
                           @if ($branchBank->province_id == $province->id)
                                <option value="{{ $province->id }}" selected="selected">{{ $province->name }}</option>
                            @else
                                <option value="{{ $province->id }}">{{ $province->name }}</option>
                            @endif
                      @endforeach
                    </select>
                    {{ $errors->first('province', '<span class="help-inline">:message</span>') }}
                </div>
            </div>
            {{-- Brank --}}
            <div class="control-group {{{ $errors->has('branch') ? 'error' : '' }}}">
                <label class="control-label" for="title">Bank</label>
                <div class="controls">
                    {{$branchBank->branch_id}}
                    <select name="branch" id="branch">
                       @foreach ($branches as $b)
                        @if ($branchBank->id == $b->id)
                            <option value="{{ $b->id }}" selected="selected">{{ strlen($b->branch_name) > 0 ? $b->branch_name : $b->place->name }}</option>
                        @else
                            <option value="{{ $b->id }}">{{ strlen($b->branch_name) > 0 ? $b->branch_name : $b->place->name }}</option>
                        @endif
                      @endforeach
                    </select>
                    {{ $errors->first('branch', '<span class="help-inline">:message</span>') }}
                </div>
            </div>

            <!-- Content -->
            <div class="control-group {{{ $errors->has('description') ? 'error' : '' }}}">
                <label class="control-label" for="content">Description</label>
                <div class="controls">
                    <textarea class="full-width span10 wysihtml5" name="description" value="description" rows="10">{{ $location->description }}</textarea>
                    {{ $errors->first('description', '<span class="help-inline">:message</span>') }}
                </div>
            </div>
            <!-- ./ content -->
        </div>
        <!-- /General tab -->

        <!-- Address tab -->
        <div class="tab-pane" id="tab-address">
            <div class="control-group">
                <label class="control-label" for="house">Address</label>
                <div class="controls">
                    <input type="text" name="house" placeholder="House" class="input-medium" value="{{{ $location->house }}}" />
                    <input type="text" name="street" placeholder="Street" class="input-medium" value="{{{ $location->street }}}" />
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="commune">Commune/ Sangkat</label>
                <div class="controls">
                    <input type="text" name="commune" id="commune" class="input-xlarge" value="{{{ $location->sangkat }}}" />

                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="khan">District / Khan</label>
                <div class="controls">
                    <input type="text" name="khan" id="khan" class="input-xlarge" value="{{{ $location->khan }}}" />
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="phone">Phone</label>
                <div class="controls">
                    <input type="text" name="phone" id="phone" class="input-xlarge" value="{{{ $location->phone }}}" />
                </div>
            </div>

            <div class="control-group {{{ $errors->has('email') ? 'error' : '' }}}">
                <label class="control-label" for="email">Email</label>
                <div class="controls">
                    <input type="text" name="email" id="email" class="input-xlarge" value="{{{ $location->email }}}" />
                    {{ $errors->first('email', '<span class="help-inline">:message</span>') }}
                </div>
            </div>

            <div class="control-group {{{ $errors->has('website') ? 'error' : '' }}}">
                <label class="control-label" for="website">Website</label>
                <div class="controls">
                    <input type="text" name="website" id="website" class="input-xlarge" value="{{{ $location->website }}}" />
                    {{ $errors->first('website', '<span class="help-inline">:message</span>') }}
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">Maps</label>
                <div class="controls">
                    <input type="text" name="lat" id="title" class="input-medium" placeholder="lattitude" value="{{{ $location->lat }}}" />
                    <input type="text" name="lng" id="title" class="input-medium" placeholder="longtitude"value="{{{ $location->lng }}}" />
                </div>
            </div>
        </div>

        <!-- /Address tab -->

        <!-- Media tab -->
        <div class="tab-pane" id="tab-media">
            <div class="control-group {{{ $errors->has('img') ? 'error' : '' }}}">
                <label class="control-label" for="img">Logo</label>
                <div class="controls">
                    <input type="text" name="img" id="img" class="input-xlarge" value="{{{ $location->image }}}" />
                    {{ $errors->first('img', '<span class="help-inline">:message</span>') }}
                </div>
            </div>
            <div class="control-group {{{ $errors->has('image') ? 'error' : '' }}}">
                <label class="control-label" for="content">Image</label>
                <div class="controls">
                    <div><img src="/uploads/images/locations/thumb/{{{ $location->image }}}" alt="{{{ $location->name }}}"/>
                    </div>
                     <input type="file" name="image"/>
                      {{ $errors->first('image', '<span class="help-inline">:message</span>') }}
                </div>
            </div>
        </div>
        <!-- /Media tab -->

    </div>
       <!-- /Tabs Content -->

      <!-- Form Actions -->
    <div class="control-group">
        <div class="controls">
            <a class="btn btn-link" href="{{{ URL::to('admin/locations') }}}">Cancel</a>
            <button type="submit" class="btn btn-success">Update</button>
        </div>
    </div>
    <!-- ./ form actions -->
</form>
@stop
